#include "processmanager.h"

ProcessManager::ProcessManager(QObject *parent) :
    QObject(parent)
{   


}

void ProcessManager::ipSet()
{
    QString program = "cmd";
    QStringList arguments;
    arguments << "netsh interface ip set address name=\"LAN\" source=static addr=192.168.0.177 mask=255.255.255.0 gateway=192.168.0.1 gwmetric=1" ;
    arguments << "netsh interface ip set dns \"LAN\" static 192.168.0.1";
    QProcess *myProcess = new QProcess(this);
    connect(myProcess, &QProcess::readyRead,
            [=]()
    {
        QByteArray j = myProcess->readAll();
        QTextCodec* defaultTextCodec = QTextCodec::codecForName("Windows-1251");
        QTextCodec* htmlTextCodec = QTextCodec::codecForHtml(j, defaultTextCodec);
        QString unicode = htmlTextCodec->toUnicode(j);
        unicode.replace("Подключение по локальной сети","x2x");

        qDebug()<<unicode;
        //qDebug()<<myProcess->readAll();
    });
    // myProcess->start(program, arguments);
}

